<template>
    <div>
        <!-- 模态框 -->
        <el-dialog title="删除用户" :visible.sync="thistype" @close='fun(tname)'>
            <div style="text-align:center">
                你确定要删除用户
                <span style="color:pink">{{tablerow.name}}</span>
                吗？
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="mgrdelete">确定</el-button>
            </div>
        </el-dialog>
        <!-- 模态框 结束 -->
    </div>
</template>
<script>
import {http,user} from '../../api/api.js'
export default {
    props:['type','fun','tablerow','tname'],
    data() {
        return {
            thistype:this.type,//模态框状态

        }
    },
    
    methods: {
       mgrdelete(){
           this.$http.delete(http+user,{
               params:{
                   userId:this.tablerow.id
               }
           }).then((data)=>{
               if(data.data.msg=='成功'){
                   this.thistype = false
               }else{
                   this.$message.error(data.data.message)
               }
           },(err)=>{
            //    loacation.href = './login.html'
            this.$message.error(err.data.message);
           })
       }
    },
    watch:{
        type(){
            this.thistype=this.type
        }
    }
}
</script>
